package com.value.utils;

import java.text.DecimalFormat;

/**
 * Unibon
 * <p/>
 * Copyright (c) 2012 YouPeng ValueSoft Inc., All rights reserved.
 * <p/>
 * This software is the confidential and proprietary information of
 * ValueSoft Company. ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with ValueSoft.com.
 * <p/>
 * Revision History
 * Date      		Programmer       Notes
 * 13-8-21   	     laborc		     Initial
 * *********************************************************************
 */
public class StringUtil {
    /**
     * 代替null
     * @param source
     * @return
     */
    public static String replaceNull(String source){
        if (source==null){
            return "";
        }
        return "";
    }

    /**
     * 左边补零
     * @param length
     * @param target
     * @return
     */
    public static String zerofill(int length,Long target){
        if(length>0&&target>0){
            StringBuffer sb = new StringBuffer();
            for(int i=0 ; i<length ; i++){
                sb.append("0");
            }
            DecimalFormat df = new DecimalFormat(sb.toString());
            return df.format(target);
        }
        return "";
    }
}
